The Princess Who Was Hidden Underground is a German fairy tale. Andrew Lang included it in The Violet Fairy Book.[1]
A king had three sons and divided his property. The older two squandered theirs, but the youngest son was prudent, and became rich. He had an underground castle built, killed the architect, imprisoned his daughter there, and decreed that whoever could find her would marry her, but whoever tried and failed would die. Many did die.
A clever and handsome young man had a shepherd sew him into a golden sheep fleece and then bring him to the king. When the king wanted to buy the sheep, the shepherd said he could only lend it for three days. The king took the sheep to the daughter, using a magical charm to open her castle. In the night, the man threw off the sheepskin, and the princess fell in love with him. She told him that the king would insist on his finding her among her maids, after he had turned them into ducks. She would preen, and so he could identify her.
When the three days were up, the shepherd came for his sheep, and the king returned him, back in his sheephide. The young man found the princess by the same way as the king had gone, and the king demanded he identify her when he had turned her and all her maids to ducks. The young man did this, and the king had to yield.
This method of winning the princess is also found in the fairy tales The Fair Fiorita and The Golden Lion.